---
title: Charmhub | tempo-k8s docs - Charm traces and spans
description: Traces in charm tracing When we refer to charm tracing, it is concerned
  with pushing traces of the charm execution flow not with the workload flow...
url: https://charmhub.io/topics/charmed-tempo-ha/traces & spans in charm realm
---

# tempo-k8s docs - Charm traces and spans

## [Traces in charm tracing](https://charmhub.io/topics/charmed-tempo-ha/traces & spans in charm realm#p-31365-traces-in-charm-tracing)

When we refer to charm tracing, it is concerned with pushing traces of the `charm` execution flow not with the workload flow itself.

With that, there is an analogy between traces and charm events (hooks) that occur during a charm’s life cycle. With every hook fired, charm execution begins and that starts a new `trace` indicating the start of an execution flow with a parent `span` called `charm exec`.

## [Spans in charm tracing](https://charmhub.io/topics/charmed-tempo-ha/traces & spans in charm realm#p-31365-spans-in-charm-tracing)

There are several occasions where a span will be created under a trace during a charm execution:

* when a [`juju event`](https://juju.is/docs/sdk/list-of-events#heading--juju-events) is fired, a `child span` is created whose parent is the `charm exec` span.
* when an [`ops event`](https://juju.is/docs/sdk/list-of-events#heading--ops-events) is fired, a `child span` is created whose parent is the `charm exec` span.
* when a non-dunder `charm class method` gets called as part of the charm execution, a `child span` is created whose parent is either a [`juju event`](https://juju.is/docs/sdk/list-of-events#heading--juju-events) span or an [`ops event`](https://juju.is/docs/sdk/list-of-events#heading--ops-events) span.
* when a non-dunder `extra class method` gets called as part of the charm execution, a `child span` is created whose parent is either a [`juju event`](https://juju.is/docs/sdk/list-of-events#heading--juju-events) span or an [`ops event`](https://juju.is/docs/sdk/list-of-events#heading--ops-events) span.

## [Tracing a trace](https://charmhub.io/topics/charmed-tempo-ha/traces & spans in charm realm#p-31365-tracing-a-trace)

This section assumes prior knowledge on a charm’s lifecycle and [control flow](https://discourse.charmhub.io/t/talking-to-a-workload-control-flow-from-a-to-z/6161).

Assuming you have [a charm instrumented for sending traces to a tempo backend](https://charmhub.io/topics/charmed-tempo-ha/integrate tracing):

When the periodical [update\_status hook](https://juju.is/docs/sdk/update-status-event) fires, by the end of your charm execution for this hook, an example execution flow can look like the below:

you’ll have a `trace` created in your tempo backend with a similar structure to the below:

---

*Last updated 2 years ago.*

[Help improve this document in the forum](https://discourse.charmhub.io/t/tempo-k8s-docs-charm-traces-and-spans/14029).
